package com.akcome.apollo.controller;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.akcome.apollo.common.ApolloConstants;
import com.akcome.apollo.common.MathUtil;
import com.aliyuncs.utils.Base64Helper;

@RequestMapping("/query")
@Controller
public class QueryController {

	/**
	 * 旷工管理
	 * @param modelMap
	 * @return
	 * @throws UnsupportedEncodingException 
	 */
	@RequestMapping("/worker/{accountId}")
	public String worker(@PathVariable String accountId, HttpServletResponse response) throws UnsupportedEncodingException{
		//Base64Helper.encode("3".getBytes());
		String a = Base64Helper.decode(accountId, "utf-8");
		Cookie cookie = new Cookie(ApolloConstants.COOKIE_ACCOUNT, a);
		cookie.setPath("/");
		response.addCookie(cookie);
		return "query/workers";
	}
	
}
